$.fn.pageNumberRender = function() {
    var a, b, c, d, e, f, g, h, i, j, k, l, m, o, p;
    if ($(this).empty(), $(this).attr("total") ? a = Number($(this).attr("total")) : alert(uncompile(quiLanguage.pageNumber.errorMessage1)), 
    b = 10, $(this).attr("pageSize") ? b = Number($(this).attr("pageSize")) : $(this).attr("pageSize", b), 
    c = 50, null != $(this).attr("selWidth") && (c = Number($(this).attr("selWidth"))), 
    d = !1, (1 == $("#skin").attr("splitMode") || "true" == $("#skin").attr("splitMode")) && (d = !0), 
    e = 0, d || (f = $(window.top.document.getElementById("theme")), null != f.attr("defaultPageSelWidth") && (e = Number(f.attr("defaultPageSelWidth")))), 
    g = 3, $(this).attr("centerPageNum") && (g = Number($(this).attr("centerPageNum"))), 
    h = 1, $(this).attr("edgePageNum") && (h = Number($(this).attr("edgePageNum"))), 
    i = 0, $(this).attr("page") ? i = Number($(this).attr("page")) : $(this).attr("page", i), 
    j = uncompile(quiLanguage.pageNumber.prePageText), $(this).attr("prevText") && (j = $(this).attr("prevText")), 
    k = uncompile(quiLanguage.pageNumber.nextPageText), $(this).attr("nextText") && (k = $(this).attr("nextText")), 
    l = !1, ("true" == $(this).attr("showSelect") || 1 == $(this).attr("showSelect")) && (l = !0), 
    m = {
        list: [ {
            key: 10,
            value: 10
        }, {
            key: 20,
            value: 20
        }, {
            key: 50,
            value: 50
        } ]
    }, $(this).attr("selectData")) try {
        m = JSON.parse($(this).attr("selectData"));
    } catch (n) {
        m = {
            list: [ {
                key: 10,
                value: 10
            }, {
                key: 20,
                value: 20
            }, {
                key: 50,
                value: 50
            } ]
        }, alert(uncompile(quiLanguage.pageNumber.errorMessage2));
    }
    o = !1, ("true" == $(this).attr("showInput") || 1 == $(this).attr("showInput")) && (o = !0), 
    p = "top", "bottom" == $(this).attr("selectDirection") && (p = "bottom"), $(this).pagination(a, {
        items_per_page: b,
        num_display_entries: g,
        num_edge_entries: h,
        current_page: i,
        prev_text: j,
        next_text: k,
        showSelect: l,
        selectData: m,
        showInput: o,
        selectDirection: p,
        selWidth: c,
        defaultPageSelWidth: e
    });
}, jQuery.fn.pagination = function(a, b) {
    return b = jQuery.extend({
        items_per_page: 10,
        num_display_entries: 5,
        current_page: 0,
        num_edge_entries: 1,
        link_to: "javascript:void(0);",
        prev_text: uncompile(quiLanguage.pageNumber.prePageText),
        next_text: uncompile(quiLanguage.pageNumber.nextPageText),
        ellipse_text: "...",
        prev_show_always: !0,
        next_show_always: !0,
        showSelect: !1,
        selectData: {
            list: [ {
                key: 10,
                value: 10
            }, {
                key: 20,
                value: 20
            }, {
                key: 50,
                value: 50
            } ]
        },
        showInput: !1,
        selectDirection: "top",
        selWidth: 50,
        defaultPageSelWidth: 0,
        callback: function() {
            return !1;
        }
    }, b || {}), this.each(function() {
        function c() {
            return Math.ceil(a / b.items_per_page);
        }
        function d() {
            var a = Math.ceil(b.num_display_entries / 2), d = c(), e = d - b.num_display_entries, f = g > a ? Math.max(Math.min(g - a, e), 0) : 0, h = g >= a ? Math.min(g + a, d) : Math.min(b.num_display_entries, d);
            return [ f, h ];
        }
        function e(a, b, c) {
            g = a, f();
            var d;
            return d = h.trigger("pageChange", g), h.attr("page", g), c && h.trigger("sizeChange", c), 
            d || (b.stopPropagation ? b.stopPropagation() : b.cancelBubble = !0), d;
        }
        function f() {
            var a, i, j, k, l, m, n, o, p, q, r, s;
            if (h.empty(), a = d(), i = c(), j = function(a) {
                return function(b) {
                    return e(a, b);
                };
            }, k = function(a, b) {
                var c;
                a = 0 > a ? 0 : i > a ? a : i - 1, b = jQuery.extend({
                    text: a + 1,
                    classes: ""
                }, b || {}), c = a == g ? jQuery("<span class='current'>" + b.text + "</span>") : jQuery("<a>" + b.text + "</a>").bind("click", j(a)), 
                b.classes && c.addClass(b.classes), h.append(c);
            }, b.prev_text && (g > 0 || b.prev_show_always) && k(g - 1, {
                text: b.prev_text,
                classes: "prev"
            }), a[0] > 0 && b.num_edge_entries > 0) {
                for (l = Math.min(b.num_edge_entries, a[0]), m = 0; l > m; m++) k(m);
                b.num_edge_entries < a[0] && b.ellipse_text && jQuery("<span class='ellipse'>" + b.ellipse_text + "</span>").appendTo(h);
            }
            for (m = a[0]; m < a[1]; m++) k(m);
            if (a[1] < i && b.num_edge_entries > 0) for (i - b.num_edge_entries > a[1] && b.ellipse_text && jQuery("<span class='ellipse'>" + b.ellipse_text + "</span>").appendTo(h), 
            n = Math.max(i - b.num_edge_entries, a[1]), m = n; i > m; m++) k(m);
            b.next_text && (i - 1 > g || b.next_show_always) && k(g + 1, {
                text: b.next_text,
                classes: "next"
            }), 1 == b.showSelect && (o = $("<select></select>"), o.data("data", b.selectData), 
            p = $('<div style="float:left;padding:5px 0 0 5px">' + uncompile(quiLanguage.pageNumber.pageNumText1) + '</div><div style="float:left;padding:0 0 0 2px;"></div><div style="float:left;padding:5px 0 0 2px">' + uncompile(quiLanguage.pageNumber.pageNumText2) + "</div>"), 
            p.eq(1).append(o), q = Number(h.attr("pageSize")), o.attr("selectedValue", q), 0 != b.defaultPageSelWidth ? (p.eq(1).width(b.defaultPageSelWidth + 10), 
            o.attr("selWidth", b.defaultPageSelWidth), o.attr("boxWidth", b.defaultPageSelWidth)) : (p.eq(1).width(b.selWidth + 10), 
            o.attr("selWidth", b.selWidth), o.attr("boxWidth", b.selWidth)), o.attr("openDirection", b.selectDirection), 
            o.selectRender(), o.unbind("change"), o.bind("change", function() {
                q = o.attr("relValue"), h.attr("pageSize", q), b.items_per_page = Number(q);
                var a = c();
                g > a - 1 ? e(a - 1, null, q) : h.trigger("sizeChange", q), f();
            }), h.append(p)), 1 == b.showInput && (r = $('<input type="text" style="width:30px;" inputMode="numberOnly"/>'), 
            s = $('<div style="float:left;padding:5px 0 0 5px">' + uncompile(quiLanguage.pageNumber.pageJumpText1) + '</div><div style="float:left;padding:0 0 0 2px"></div><div style="float:left;padding:5px 0 0 2px">' + uncompile(quiLanguage.pageNumber.pageJumpText2) + "</div>"), 
            s.eq(1).append(r), r.render(), r.keydown(function(a) {
                if (13 == a.keyCode) {
                    var b = c();
                    Number(r.val()) > b ? e(b - 1) : Number(r.val()) < 1 ? e(0) : e(Number(r.val()) - 1);
                }
            }), h.append(s)), h.append($('<div style="clear:both;"></div>'));
        }
        var h, g = b.current_page;
        a = !a || 0 > a ? 1 : a, b.items_per_page = !b.items_per_page || b.items_per_page < 0 ? 1 : b.items_per_page, 
        h = jQuery(this), h.data("selectCurrent", b.selectCurrent), this.selectPage = function(a) {
            e(a);
        }, this.prevPage = function() {
            return g > 0 ? (e(g - 1), !0) : !1;
        }, this.nextPage = function() {
            return g < c() - 1 ? (e(g + 1), !0) : !1;
        }, f();
    });
};